<template>
  <div class="width-100 height-100 overflow-auto">
    <div class="padding grid-content">
      <grid-item-one title="能源消费情况分析"></grid-item-one>
      <grid-item-two title="能源消费总量趋势"></grid-item-two>
      <grid-item-three title="能源消费结构及占比"></grid-item-three>
      <focus-energy title="电数据分析" :type="type2" :type-text="getTypeText(type2)"></focus-energy>
      <focus-energy title="煤数据分析" :type="type1" :type-text="getTypeText(type1)"></focus-energy>
      <focus-energy title="气数据分析" :type="type3" :type-text="getTypeText(type3)"></focus-energy>
    </div>
  </div>
</template>

<script>
import GridItemOne from './grid-item-one'
import GridItemTwo from './grid-item-two'
import GridItemThree from './grid-item-three'
import FocusEnergy from '@/views/data-presentation-overview/focus-energy'
import { ELECTRIC, WATER, GAS, GAS_TEXT, ELECTRIC_TEXT, WATER_TEXT, COAL_TEXT, COAL } from '@/config'

export default {
  name: 'data-presentation-overview',
  components: {
    GridItemOne,
    GridItemTwo,
    GridItemThree,
    FocusEnergy,
  },
  data () {
    return {
      type1: COAL,
      type2: ELECTRIC,
      type3: GAS,
    }
  },
  methods: {
    getTypeText (type) {
      const texts = {
        [WATER]: WATER_TEXT,
        [ELECTRIC]: ELECTRIC_TEXT,
        [GAS]: GAS_TEXT,
        [COAL]: COAL_TEXT,
      }
      return texts[type]
    },
  },
}
</script>

<style lang="scss" scoped>
@import "@/assets/style/variable.scss";

.grid-content {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-gap: $gutter;
}

::v-deep .content-block {
  grid-column-start: 1;
  grid-column-end: 3;
  background: white;
  border-radius: 4px;

  .info-head {
    padding: 20px $gutter 0 $gutter;
    font-size: 16px;
  }

  &.block-half-1 {
    grid-column-start: 1;
    grid-column-end: 2;
  }

  &.block-half-2 {
    grid-column-start: 2;
    grid-column-end: 3;
  }
}
</style>
